<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>智慧农场网站后台</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        html,
        body {
            width: 100%;
            height: 100%;
        }

        .cms_login {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            background-repeat: no-repeat;
            background-image: url(../img/3.jpg);
            background-size: 100% 100%;
        }

        .flexCenter {
            text-align: center;
            margin: auto;
        }

        .cms_login_container {
            width: 70%;
            height: 70%;
            display: flex;
            justify-content: center;
        }

        .cms_login_image {
            width: 60%;
            height: 100%;
        }

        .cms_login_from {
            width: 40%;
            height: 100%;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0px 0px 10px #ccc;
        }

        /* .cms_login_container {
            width: 30%;
            height: 70%;
            border: 1px solid red;
        } */

        img {
            width: 100%;
            height: 100%;
        }

        .divBox {
            display: flex;
            justify-content: center;
            width: 80%;
            height: 46px;
            margin-top: 20px;
            margin-left: 10%;
            position: relative;
        }

        .cms_login_logo {
            display: flex;
            justify-content: center;
            width: 80%;
            height: 60px;
            /* border: 1px solid green; */
            margin-left: 10%;
            margin-bottom: 22px;
            margin-top: 25px;
        }

        .cms_login_img {
            width: 44px;
            height: 44px;
            position: absolute;
            top: 1px;
            left: 1px;
        }

        .cms_login_ipt {
            width: 100%;
            outline: none;
            padding-left: 50px;
        }

        .cms_login_ipt60 {
            width: 60%;
            outline: none;
            padding-left: 50px;
        }

        .cms_login_ver {
            width: 30%;
            outline: none;
            margin-left: 8%;
            border: 1px solid #c32c2c;
            background-color: #bd7070;
            line-height: 46px;
            letter-spacing: 4px;
            border-radius: 4px;
            cursor: default;
            color: white;
        }

        .margin_top60 {
            margin-top: 40px;
        }

        .login_btn {
            width: 100%;
            height: 60px;
            letter-spacing: 10px;
            font-size: 24px;
            background-color: green;
            border: none;
            outline: none;
            border-radius: 10px;
            color: white;
        }

        .login_btn:hover {
            background-color: #044468;
            border: none;
            outline: none;
        }
    </style>
</head>

<body>
<div class="cms_login">
    <div class="cms_login_container flexCenter" style="min-height:390px;">
        <div class="cms_login_image" style="min-width: 380px;">
            <!-- <img src="./leftimg_04.png" alt=""> -->
        </div>
        <div class="cms_login_from" style="min-width: 380px;">
            <form>
                <div class="cms_login_logo"><span style="font-size:24px;">生产人员后台登录</span></div>
                <div class="divBox"> <img class="cms_login_img" src="../img/username_mark.png"> <input
                        class="cms_login_ipt" type="text" placeholder="请输入手机号" id="cms_login_username"></div>
                <div class="divBox"> <img class="cms_login_img" src="../img/password_mark.png"><input type="password"
                                                                                                      placeholder="请输入密码" class="cms_login_ipt" id="cms_login_passward"></div>
<!--                <div class="divBox"> <img class="cms_login_img" src="img/verify_mark.png"><input type="text"-->
<!--                                                                                                 placeholder="请输入验证码" class="cms_login_ipt60" id="cms_login_ver_ipt">-->
<!--                    <span class="cms_login_ver" value="6666" id="cms_login_ver">6666</span>-->
<!--                </div>-->
                <div class="divBox margin_top60" style="border:none;">
                    <input class="login_btn" type="button" value="登录" name="submit">
                </div>
            </form>
        </div>
    </div>
</div>

<script src="../js/jquery-1.12.4.js"></script>
<script>
    // 随机验证码
    var m = parseInt(Math.random(0, 9) * (9999 - 1000) + 1000);
    var n = $(".cms_login_ver").text(m)
    // 原生获取文本内容
    // var n = document.getElementsByClassName("cms_login_ver")[0].innerHTML;
    // console.log(n)
    // 点击按钮判断账户密码
    $(".login_btn").click(function () {
        var username = $("#cms_login_username").val();
        var password = $("#cms_login_passward").val();
        var ver = $("#cms_login_ver_ipt").val();
        // console.log(typeof username)
        // console.log(ver)
        // 判断用户账户是不是能够转换成number类型，能，是false，不是true
        $.post("/tproducer/login",
            {'phone':username,'password':password},
        function (res){
            if (res == 'yes'){
                alert("登录成功");
                window.location.href='/pages/producter_work.html';
            }else if (res == 'no'){
                alert("登录失败");
            }
        });
    })

</script>

</body>
</html>